import React, { createContext, ReactNode } from 'react';

interface SlotProviderProps {
  children: (slots: Record<string, ReactNode>) => ReactNode;
}

export const SlotContext = createContext<Record<string, ReactNode>>({});

export function SlotProvider({ children }: SlotProviderProps) {
  const slots: Record<string, ReactNode> = {};

  function registerSlot(name: string, content: ReactNode) {
    slots[name] = content;
  }

  return (
    <SlotContext.Provider value={{}}>{children(slots)}</SlotContext.Provider>
  );
}
